package com.lz.autotest.project.testmanage.autoTest.service.Listener;

import com.lz.autotest.common.utils.spring.SpringUtils;
import com.lz.autotest.project.testmanage.reportmanage.domain.SstReportItem;
import com.lz.autotest.project.testmanage.reportmanage.mapper.InfReportMapper;
import com.lz.autotest.project.testmanage.reportmanage.service.InfReportService;

import java.util.Map;

/**
 * @author: X
 * @date: Created in 2023/7/3 10:39
 * @Description:
 */
public class DownloadDataListener extends Listener {


    public DownloadDataListener(String listenerType, Integer priority) {
        super(listenerType, priority);
    }

    @Override
    public void execute(Map<String, Object> map) {
        String ip = (String) map.get("ip");
        SstReportItem sstReportItem = (SstReportItem) map.get("msg");
        InfReportMapper infReportMapper = SpringUtils.getBean(InfReportMapper.class);
        InfReportService infReportService = SpringUtils.getBean(InfReportService.class);
        infReportMapper.saveInfReportItem(sstReportItem);
        infReportService.updateAutoStatus(ip, sstReportItem);
    }
}
